import json

from ronglian_sms_sdk import SmsSDK

accId = '8a216da87051c90f0170619a28840938'

accToken = '36b9aea2ff194a2aaa293e8e27cf9520'

appId = '8a216da87051c90f0170619a28de093e'

def send_message(phone,datas):
    sdk = SmsSDK(accId,accToken,appId)
    # 指定测试模板
    tid = '1' 
    # 参数按照位置传递(模板，测试手机号，发送内容)
    resp = sdk.sendMessage(tid,phone,datas)

    # 格式化
    resp_dict = json.loads(resp)
    # 验证手机号是否发送成功(-1为未成功，0为成功)
    if resp_dict.get('statusCode') == '000000':
        return 0
    return -1